package com.gjp.service;

import com.gjp.entity.UserEntity;
import com.gjp.jpa.UserJPA;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by 郭金鹏 on 2017/5/29.
 */
@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    private UserJPA userJPA;

    @Override
    public UserEntity findOne(Long id) {
        return userJPA.findOne(id);
    }

    @Override
    public List<UserEntity> findAll() {
        return userJPA.findAll();
    }

    @Override
    public Page<UserEntity> findAllByPage(Pageable pageable) {
        return userJPA.findAll(pageable);
    }

    @Override
    public UserEntity save(UserEntity userEntity) {
        return userJPA.save(userEntity);
    }

    @Override
    public void delete(Long id) {
        userJPA.delete(id);
    }


}
